import React from 'react';
import { View, Text, Image, StyleSheet } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import { COLORS, SHADOWS } from '../styles/constants';

export default function TourCard({ cover, title, rating = 4.8, price = 299 }) {
  return (
    <View style={styles.card}>
      <Image source={cover} style={styles.cover} resizeMode="cover" />
      <View style={styles.info}>
        <Text numberOfLines={1} style={styles.title}>
          {title}
        </Text>
        <View style={styles.row}>
          <Icon name="star" size={14} color={COLORS.status.warning} />
          <Text style={styles.rating}>{rating.toFixed(1)}</Text>
          <Text style={styles.dot}>·</Text>
          <Text style={styles.price}>¥{price}</Text>
        </View>
      </View>
    </View>
  );
}

const styles = StyleSheet.create({
  card: {
    width: 200,
    borderRadius: 12,
    backgroundColor: COLORS.background.card,
    overflow: 'hidden',
    marginRight: 12,
    ...SHADOWS.sm,
  },
  cover: {
    width: '100%',
    height: 120,
    backgroundColor: COLORS.background.secondary,
  },
  info: {
    padding: 10,
  },
  title: {
    fontSize: 15,
    fontWeight: '600',
    color: COLORS.text.primary,
  },
  row: {
    flexDirection: 'row',
    alignItems: 'center',
    marginTop: 6,
  },
  rating: {
    marginLeft: 4,
    color: COLORS.text.secondary,
    fontSize: 12,
  },
  dot: {
    marginHorizontal: 6,
    color: COLORS.text.quaternary,
  },
  price: {
    color: COLORS.text.primary,
    fontWeight: '600',
  },
});
